package ui.adapter;

import android.content.Context;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.amap.api.services.core.PoiItem;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.fy.fyzf.R;
import com.fy.fyzf.base.Contans;

import org.litepal.util.Const;

import java.util.List;

public class AroundAdapter extends BaseQuickAdapter<PoiItem, BaseViewHolder> {

    private Context mContext;
    public AroundAdapter(Context context) {
        super(R.layout.item_around);
        mContext = context;
    }

    private int type = 0;
    public void setType(int i){
        type = i;
        notifyDataSetChanged();
    }
    @Override
    protected void convert(BaseViewHolder helper, PoiItem item) {
        TextView textView = helper.getView(R.id.tv_name);
        switch (type) {
            case 0:
                textView.setCompoundDrawablesWithIntrinsicBounds( mContext.getResources().getDrawable(R.mipmap.icon_bus),null, null, null);
                break;
            case 1:
                textView.setCompoundDrawablesWithIntrinsicBounds( mContext.getResources().getDrawable(R.mipmap.icon_catering),null, null, null);
                break;
            case 2:
                textView.setCompoundDrawablesWithIntrinsicBounds( mContext.getResources().getDrawable(R.mipmap.icon_hotel),null, null, null);
                break;
            case 3:
                textView.setCompoundDrawablesWithIntrinsicBounds( mContext.getResources().getDrawable(R.mipmap.icon_bank),null, null, null);
                break;
            case 4:
                textView.setCompoundDrawablesWithIntrinsicBounds( mContext.getResources().getDrawable(R.mipmap.icon_health),null, null, null);
                break;
        }
        helper.setText(R.id.tv_name, item.toString());

    }
}
